package jinyilw.swing;
import jinyilw.common.file.FileTools;
import jinyilw.swing.i18n.IString;
import jinyilw.swing.visuals.Icomp.IFileChooser;
import jinyilw.swing.visuals.Rcomp.RFileChooser;

import javax.swing.JFileChooser;
import java.io.File;
public class ChooseFileUtils
{
	private ChooseFileUtils()
	{
	}

	public static RFileChooser getDirectoryChooser(String path, String title)
	{
		return getDirectoryChooser(FileTools.getUserFile(path), title);
	}

	public static RFileChooser getDirectoryChooser(File folder, String title)
	{
		RFileChooser fileChooser = new RFileChooser(folder);
		fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
		fileChooser.setDialogTitle(title);
		return fileChooser;
	}

	public static IFileChooser getDirectoryChooser(String path, IString title)
	{
		return getDirectoryChooser(FileTools.getUserFile(path), title);
	}

	public static IFileChooser getDirectoryChooser(File folder, IString title)
	{
		IFileChooser fileChooser = new IFileChooser(folder, title);
		fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
		return fileChooser;
	}
}
